//
//  SGGroupTableViewCell.m
//  朋友圈
//
//  Created by gzz on 2017/6/24.
//  Copyright © 2017年 gzz. All rights reserved.
//

#import "SGGroupTableViewCell.h"

@interface SGGroupTableViewCell()

//左边显示的图片
@property(nonatomic,strong) UIImageView *leftImageView;

//图片的数目

@property(nonatomic,strong)UILabel *nameLabel;


@end

@implementation SGGroupTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        
//        创建Cell的UI
        [self createCellUI];
        
    }
    return self;
}
-(void)createCellUI
{
    
//    图片列表左边图片
    UIImageView *leftImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 80, 80)];
    [self.contentView addSubview:leftImageView];
    self.leftImageView = leftImageView;
//    当前分组下有多少张图片
    UILabel *nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(90, 21, 200, 30)];
    nameLabel.textAlignment = NSTextAlignmentLeft;
    nameLabel.font = [UIFont systemFontOfSize:15.0];
    [self.contentView addSubview:nameLabel];
    self.nameLabel = nameLabel;
    
//    最右边图片    >
    
    UIImageView *rightImageView = [[UIImageView alloc]initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width-40, (80-11.5)/2, 7, 11.5)];
    rightImageView.image = [UIImage imageNamed:@"icon01@2x"];
    
    [self.contentView addSubview:rightImageView];
    
    
                   
}

-(void)configUI:(SGPhotoAblumList *)ablum
{
    [[SGPhotoList sharePhotoTools]requestImageForAsset:ablum.headImageAsset size:CGSizeMake(80*3, 80*3) resizeMode:PHImageRequestOptionsResizeModeFast completion:^(UIImage *image, NSDictionary *dic)
     {
         self.leftImageView.image = image;
         
     }];
    
    self.nameLabel.text = [NSString stringWithFormat:@"%@ (%ld)",ablum.tittle,ablum.count];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
